-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test cases related to JWT authentication. #2179
Test cases related to JWT authentication. #2179
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking for a little more testing depth - is that possible with jwt error responses or another system?
src/integrationTest/java/org/opensearch/security/http/JwtAuthenticationTests.java
Show resolved
Hide resolved
c6c6dd1
to
00cafad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
096d59e
00cafad
to
096d59e
Compare
Codecov Report
@@ Coverage Diff @@
## main #2179 +/- ##
============================================
- Coverage 61.05% 61.01% -0.05%
+ Complexity 3269 3267 -2
============================================
Files 259 259
Lines 18337 18337
Branches 3248 3248
============================================
- Hits 11196 11188 -8
- Misses 5555 5559 +4
- Partials 1586 1590 +4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ty @lukasz-soszynski-eliatra . Added a few comments
src/integrationTest/java/org/opensearch/security/http/JwtAuthenticationTests.java
Show resolved
Hide resolved
this.headerName = requireNonNull(headerName, "Header name is required"); | ||
} | ||
|
||
Header validToken(String username, String...roles) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This method generates a validToken correct? If so can you please rename it as such?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the methods below as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected.
import static org.opensearch.test.framework.log.LogCapturingAppender.PLUGIN_NAME; | ||
|
||
@Plugin(name = PLUGIN_NAME, category = Core.CATEGORY_NAME, elementType = Appender.ELEMENT_TYPE, printObject = true) | ||
public class LogCapturingAppender extends AbstractAppender { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a brief javadoc of why this class is need or what does it do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also same for the class below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
5d9463b
to
d5c4a89
Compare
Bwc tests are broken on main. Tracking issue here: #2221 |
Signed-off-by: Lukasz Soszynski <[email protected]>
…son. Signed-off-by: Lukasz Soszynski <[email protected]>
Signed-off-by: Lukasz Soszynski <[email protected]>
d5c4a89
to
6a80f26
Compare
@lukasz-soszynski-eliatra Looks like there is a spotbugs issue on this PR. Can you address the issue?
|
Signed-off-by: Lukasz Soszynski <[email protected]>
6a80f26
to
397b730
Compare
Thanks, now it should work better. |
@opensearch-project/security This change blocking some of the other test PRs, can we get another review on this change? |
@peternied All checks succeeded except for the BWCTests which is a known sequencing issue. Can this be merged? |
Signed-off-by: Lukasz Soszynski [email protected]
Description
[Describe what this change achieves]
New integration tests which check if JWT authentication works correctly.
Issues Resolved
[List any issues this PR will resolve]
Is this a backport? If so, please add backport PR # and/or commits #
Testing
[Please provide details of testing done: unit testing, integration testing and manual testing]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.